﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HRM.DAL.DAO;
using HRM.DAL.Gateway;

namespace HRM.BLL
{
    public class PaySlipManager
    {
        PaySlipGateway gateway=new PaySlipGateway();
        public bool SavePaySlip(PaySlip paySlip)
        {
            EmployeeManager employeeManager=new EmployeeManager();
            int empid = employeeManager.GetEmployeeID(paySlip.Employee.EmpCode);
            if(gateway.IsPaySlipAlreadyCreated(empid,paySlip))
            {
                return false;
            }
            else
            {
                return gateway.SavePaySlip(empid, paySlip);
            }
        }
        public bool EditPaySlip(PaySlip paySlip)
        {
            EmployeeManager employeeManager = new EmployeeManager();
            int empid = employeeManager.GetEmployeeID(paySlip.Employee.EmpCode);
            return gateway.EditPaySlip(empid,paySlip);
        }
        public PaySlip GetPaySlip(PaySlip paySlip)
        {
            EmployeeManager employeeManager = new EmployeeManager();
            int empid = employeeManager.GetEmployeeID(paySlip.Employee.EmpCode);
            return gateway.GetPaySlip(empid, paySlip);
        }
        public List<PaySlip> GetAllPaySlip(PaySlip paySlip)
        {
            return gateway.GetAllPaySlip(paySlip);
        } 

    }
}